import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'

import { ERoleType } from '@shared/enums'
import { IAamsLevel } from '@shared/components/aams-select/aams-select.interface'
import { I18NService } from '@core'

@Component({
  selector: 'app-acquirer-detail-tab-users',
  templateUrl: './tab-users.component.html',
})
export class AcquirerDetailTabUsersComponent implements OnInit {
  params: {[code: string]: string}
  institutionRole = ERoleType.Acquirer
  insCode: string

  constructor(
    public route: ActivatedRoute,
    private i18n: I18NService,
  ) { }

  ngOnInit() {
    this.initQueryParams()
  }

  initQueryParams(): void {
    this.route.parent.params.subscribe(params => {
      const insCode = params['id']
      this.insCode = insCode
      this.params = {
        insCode,
        userType: IAamsLevel.Acquirer
      }
    })
  }

  trans(key: string, params?: Object): string {
    return this.i18n.fanyi(key, params)
  }
}
